package com.basic.displacement;

/**
 * 位移测试
 * @author Administrator
 *
 */
public class DisplacementTest {

	/**
	 *  位移操作 
	 *  1):<<相当于乘2
	 *  2):>>相当于除2
	 * @param args
	 */
	public static void main(String[] args) {
		int number = 10;
		print(number);
		print_ten(number);
		number = number << 1;
		print(number);
		print_ten(number);
		number = number >> 1;
		print(number);
		print_ten(number);
		number = number >>> 1;
		print_ten(number);
	}
	
	public static void print(int num){
		System.out.println("二进制："+ Integer.toBinaryString(num));
	}
	public static void print_ten(int num){
		System.out.println("十进制："+ num);
	}
}
